<template>
  <view class="modal-container">
    <view class="box">
      <view class="title">{{ title }}</view>
      <view class="btns">
        <u-button type="primary" text="确定" @click="confirm"></u-button>
        <u-button type="primary" plain text="取消" @click="close"></u-button>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  props: {
    title: {
      type: String,
      default: "确认退出登录？",
    },
  },
  methods: {
    confirm() {
      this.$emit("confirm");
    },
    close() {
      this.$emit("cancel");
    },
  },
};
</script>

<style lang="scss">
.modal-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.1);
  .box {
    background: #fff;
    border-radius: 0.5vw;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20vw;
    height: 8vw;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    .title {
      height: 5vw;
      line-height: 5vw;
      text-align: center;
    }
    .btns {
      display: flex;
      uni-button {
        width: 45%;
      }
    }
  }
}
</style>